//定义 所有的 和 医院设置相关的 请求api  的 方法
import { request } from "@utils/http"
import type { AddHospitalParams, HospitalItem, ReqHospitalSetListParams, ReqHospitalSetListResponse, UpdateHospitalParams } from "./model/hospitalSetTypes";

/**
 * 请求  获取医院设置列表的 方法
 * @param param0   {page,limit,hoscode,hosname}:ReqHospitalSetListParams
 * @returns Promise<ReqHospitalSetListResponse>
 */
export function ReqGetHospitalSetListResponse({ page, limit, hoscode, hosname }: ReqHospitalSetListParams) {
    //  Promise响应成功的结果值的类型
    return request.get<any, ReqHospitalSetListResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
        params: {
            hoscode,
            hosname
        }
    });
}


/**
 * 请求添加医院方法
 * @param hospitalSet ：AddHospitalParams
 * @returns  Promise<null>
 */
export function ReqAddHospital(hospitalSet:AddHospitalParams){
    return request.post<any,null>("/admin/hosp/hospitalSet/save",hospitalSet);
}

/**
 * 更新单个医院设置  请求的医院数据的方法 
 * @param id :number
 * @returns  Promise<HospitalItem>
 */
export function ReqGetHospitalSetItem(id:string){
    return request.get<any,HospitalItem>(`/admin/hosp/hospitalSet/get/${id}`);
}

/**
 * 请求更新医院的方法
 * @param hospitalSet UpdateHospitalParams
 * @returns Promise<null>
 */
export function ReqUpdateHospital(hospitalSet:UpdateHospitalParams){
    return request.put<any,null>("/admin/hosp/hospitalSet/update",hospitalSet);
}

/**
 * 请求删除单个医院设置信息的方法
 * @param id  string
 * @returns   Promise<null>
 */
export function ReqDeleteHospitalSet(id:number){
    request.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

/**
 * 批量删除医院信息
 * @param idList React.Key[]
 * @returns Promise<null>
 */
export function ReqBatchDeleteHospitalSet(idList:React.Key[]){
    return request.delete<any,null>("/admin/hosp/hospitalSet/batchRemove",{
        data:idList
    })
}